<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreatFileProcessingTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('file_processing', function (Blueprint $table) {
            $table->id();
            $table->unsignedTinyInteger('type')->default(0)->comment('文件类型, 1-图片 2-视频');
            $table->unsignedTinyInteger('processingType')->default(0)->comment('处理类型, 1-加水印');
            $table->string('beforeUri', 256)->default('')->comment('文件Uri');
            $table->string('afterUri', 256)->default('')->comment('文件Uri');
            $table->unsignedInteger('status')->default(0)->comment('状态 0-默认 1-已完成');
            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->collation = 'utf8mb4_general_ci';
            $table->comment   = '文件处理';

            $table->index('beforeUri', 'idx_beforeUri');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('file_processing');
    }
}
